package cn.rongdao.jrkabao.ui.deposit.adapter;

import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.TextView;

import com.mifengkong.frtools.ui.adapter.recyclerview.FRBaseRecyclerViewHolder;

import cn.rongdao.jrkabao.R;
import cn.rongdao.jrkabao.bean.deposit.SelectMonthBean;

/**
 * Created by jack on 2017/7/31
 */

public class SelectMonthViewHolder extends FRBaseRecyclerViewHolder<SelectMonthBean> {

    private TextView tvTime;
    private View viewLine;

    public SelectMonthViewHolder(View view) {
        super(view);
        tvTime = findView(R.id.ism_tv_time);
        viewLine = findView(R.id.ism_view_line);
    }

    @Override
    protected void onItemDataUpdated(SelectMonthBean data) {
        if (data.isSelected()) {
            tvTime.setTextColor(ContextCompat.getColor(getContext(), R.color.colorPrimary));
        } else {
            tvTime.setTextColor(ContextCompat.getColor(getContext(), R.color.c333333));
        }
        if (data.isLastItem()) {
            viewLine.setVisibility(View.GONE);
        }
        tvTime.setText(data.getTime());
    }
}